from django.db import models
from apis.user.models import BaseModel
# # # 发帖
# class Fatie(BaseModel):
#     uid=models.IntegerField()#写贴人的唯一标识
#     title=models.CharField(max_length=100)
#     content=models.TextField()
#     store_num = models.IntegerField(verbose_name='收藏数')
#     like_num = models.IntegerField(verbose_name='赞数')
#     Status_Choice = ((0, '删除'), (1, '未删除'))
#     status = models.IntegerField(default=0, choices=Status_Choice)
# #
# #
# # # 收藏人，点赞人表
# class Storer_Liker(BaseModel):
#     uid=models.IntegerField()#点赞人的唯一标识
#     Status_Choice = ((0, '未点赞'), (1, '点赞'))
#     status = models.IntegerField(default=0, choices=Status_Choice)
#     fatie_id =models.IntegerField(null=True)
#
# #
# #
# # # 回帖或评论
# class Reply(BaseModel):
#     fatie_id =models.IntegerField(null=True)
#     R_Uid=models.IntegerField()#回帖人的唯一标识
# #
# # # 验证码
# class Code(BaseModel):
#     Status_Choice = ((0, '激活'), (1, '改密码'),(2,'过期'),(3,'未过期'))
#     status = models.IntegerField(default=0, choices=Status_Choice)
#     code_id=models.CharField(max_length=20)
#
# # 访问表
# class Visitor(BaseModel):
#     uid = models.IntegerField()  # 访问人的uid
#     fatie_id =models.IntegerField(null=True)
#     Status_Choice = ((0, '删除'), (1, '未删除'))
#     status = models.IntegerField(default=0, choices=Status_Choice)
#
# # 邮箱或手机号更改密码记录表
# class Change_Password(BaseModel):
#     uid = models.IntegerField()  # 修改人的id
#     Status_Choice = ((0, '邮箱改密码'), (1, '手机号改密码'), (2, '自己改密码'))
#     status = models.IntegerField(default=0, choices=Status_Choice)
#     code_id = models.CharField(max_length=20)
#


class Posts(BaseModel):
    title = models.CharField(max_length=200)
    type = models.IntegerField()
    content = models.TextField()
    uid = models.IntegerField()
    status = models.IntegerField(default=0)
    collect_nums = models.IntegerField(default=0)
    like_nums = models.IntegerField(default=0)

class Comment(BaseModel):
    title = models.CharField(max_length=200,default='')
    content = models.TextField()
    p_id = models.IntegerField(default=0) #帖子的id
    father_id = models.IntegerField(default=0) #父类id
    auther_id = models.IntegerField(default=0) #没啥用
    huifu_id = models.IntegerField(default=0)
    status = models.IntegerField(default=0)


class Like(BaseModel):#点赞表
    uid = models.IntegerField()  # 点赞人的唯一标识
    Status_Choice = ((0, '未点赞'), (1, '点赞'))
    status = models.IntegerField(default=0, choices=Status_Choice)
    p_id =models.IntegerField(null=True)

class Collect(BaseModel): #收藏表
    uid = models.IntegerField()  # 收藏人的唯一标识
    Status_Choice = ((0, '未收藏'), (1, '已收藏'))
    status = models.IntegerField(default=0, choices=Status_Choice)
    p_id = models.IntegerField(null=True)


class Goods(BaseModel):
    title = models.CharField(max_length=200,default="")
    price = models.DecimalField(decimal_places=2,max_digits=10)
    img = models.CharField(max_length=200,default='')
    brief = models.CharField(max_length=300) #简介
    category_id = models.IntegerField() #所属分类
    status = models.IntegerField(default=0) #商品默认以上线
    tid = models.IntegerField(default=0) #讲师表的id
    cattention_nums = models.IntegerField(default=0) #关注人数
    learn_nums = models.IntegerField(default=0) #学过人数



class Promo_Code(BaseModel):#优惠码表
    discounts = models.CharField(max_length=100,default="折扣") #折扣
    status = models.IntegerField(default=0) #状态 0未被使用
    name = models.CharField(max_length=200,unique=True)
    # type = models.IntegerField() #优惠码的类型（课程还是会员）
    uid = models.IntegerField() #生成优惠码的用户


class Vip(BaseModel): #会员表
    uid = models.IntegerField()
    status = models.IntegerField(default=1) #默认普通会员 0 代表会员已失效
    promo_num =models.IntegerField(default=5) #普通会员默认可生成5次

class Teacher(BaseModel):
    uid = models.IntegerField()
    cattention_nums = models.IntegerField(default=0)  # 关注人数
    caller_nums = models.IntegerField(default=0) #访问人数
    status = models.IntegerField(default=0) #默认没有删除

class  Cattention(BaseModel): #讲师关注表
    uid = models.IntegerField()
    status = models.IntegerField(default=0)
    tid = models.IntegerField() #被关注讲师的唯一标识

class Caller(BaseModel):  #访问表
    uid = models.IntegerField()
    status = models.IntegerField(default=0)
    teacher = models.IntegerField()  #被关注讲师的唯一标识
    name = models.CharField(max_length=200,default='') #ip或者uid



